package com.guanghua.brick.html;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TextAreaControl extends WebControl {
	
	//private static Log logger = LogFactory.getLog(TextAreaControl.class);
	
	private String rows = null;
	private String cols = null;

	@Override
	public String buildHTML(HttpServletRequest request, HttpServletResponse response) {
		StringBuffer html = new StringBuffer();
		html.append("<textarea id=\"")
			.append(this.getId())
			.append("\" name=\"")
			.append(this.getName())
			.append("\"");
		
		if (rows != null)
			html.append(" rows=\"")
			.append(rows)
			.append("\"");
		
		if (cols != null)
			html.append(" cols=\"")
			.append(cols)
			.append("\"");
		
		html.append(this.getHtml())
			.append(">")
			.append((this.getData()!=null)?this.getData():"")
			.append("</textarea>\n");
		return html.toString();
	}

	public String getCols() {
		return cols;
	}

	public void setCols(String cols) {
		this.cols = cols;
	}

	public String getRows() {
		return rows;
	}

	public void setRows(String rows) {
		this.rows = rows;
	}
	
}
